package com.example.mybatisplus.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplus.model.domain.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author blue
 * @since 2021-12-29
 */
public interface UserMapper extends BaseMapper<User> {

    //{id:1}
    User getUserById(Long id);

    //{id:5 ,username: "admin"}
    User getUserByIdAndName(Long id , String username);

    //{id:1, username:"admin"}
    User getUserByUser(User user);

    List<User> listByName(String name);

    Page<User> listByName(@Param("page") Page<User> page, @Param("name") String name);

    Page<User> listByUser(@Param("page") Page<User> page, @Param("user") User user);

    void deleteByMaps(@Param("ids") List<Long> ids);

    void inserts(@Param("users")List<User> list);

    User getById(Long id);
}
